fix: Select二级联动清空后重新选择label未更新#426
Open
loveverse wants to merge 1 commit into
Open
Conversation
在Select组件二级联动场景中,清空选择后再次选择时,二级选项的label仍显示上一次的值。 原因:optionLabel和filter方法中直接读取this.$el.textContent,DOM更新存在时序问题导致获取到旧值。 修复:新增searchLabel数据属性,在mounted/updated生命周期中同步更新,替代直接读取DOM文本。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix[Select]: 修复二级联动清空后二级选项label残留旧值问题
问题现象
二级联动场景清空选择,再次选择二级下拉,label仍显示上一次选中内容。
根因
optionLabel与filter直接读取this.$el.textContent,DOM异步更新时序问题获取旧DOM文本。
修复
新增searchLabel响应式变量,mounted/updated生命周期同步文本,替换DOM读取逻辑。
复现地址:https://run.iviewui.com/SjmmF1BX